package cn.itcast.protocol;

import java.util.concurrent.atomic.AtomicInteger;

public abstract class SequenceIdGenerator {
    private static volatile AtomicInteger id = new AtomicInteger();

    public static int nextId() {
        while (true){
            return id.incrementAndGet();
        }
    }

//    public static void main(String[] args) {
//        for (int i = 0; i < 100; i++) {
//            System.out.println(nextId());
//        }
//
//    }
}